Repository navigation
Multibackend (GCC + LLVM) - #582
SamuelMarks wants to merge 4 commits into
Conversation
|
Important Review skippedToo many files! This PR contains 632 files, which is 482 over the limit of 150. To get a review, reduce the PR to 150 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. Usage-priced reviews support at most 500 files.
|
…river [GH edgcpp#582] Unify the EDG C/C++ front end with native LLVM IR (llvm_gen_be) and GCC (libgccjit / gcc_gen_be) code-generating backends, a shared Stage-0 GCC/Clang/MSVC-compatible CLI driver and SDK discovery layer, an Itanium C++ ABI exception-handling runtime for libgccjit, CMake 4-way backend option support, and 100% documentation, function/line/branch test coverage, and error-enum/noexcept enforcement across all platforms. Signed-off-by: Samuel Marks <807580+SamuelMarks@users.noreply.github.com>
382a5af to
b15e653
Compare
|
AcknowlEDG review results updated for
CI failure. |
…dgcpp#582] Resolve the four cross-platform build, linkage, and Release-posture defects surfaced by the 15-job multi-OS release matrix (.github/workflows/release.yml, configured with -DEDG_BUILD_LIB=OFF -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release): 1. Standalone gcc_be_eh_rt target configuration (CMakeLists.txt, .github/workflows/release.yml): - When both EDG_BUILD_LIB and BUILD_TESTING are OFF, neither lib_src/ nor tests/gcc_be/ defines gcc_be_eh_rt, activating the root CMakeLists.txt fallback target. That fallback omitted ${CMAKE_SOURCE_DIR}/src from target_include_directories (failing on #include "gcc_gen_be_error.h"), compiled C++17 DWARF/Itanium source lib_src/gcc_be_eh_rt.c as C11 without BACK_END_IS_GCC_GEN_BE=1, and attempted to build the POSIX/Itanium <unwind.h> trampoline archive under WIN32/MSVC. - Gate the standalone gcc_be_eh_rt target on NOT WIN32, expose both lib_src/ and src/ include directories, define BACK_END_IS_GCC_GEN_BE=1, compile as C++17 (-x c++ -std=c++17 -fno-exceptions -fno-rtti -funwind-tables -fasynchronous-unwind-tables -Wunused-result -Werror=unused-result), and bundle lib/libedg_gcc_eh_rt.a into POSIX release archives when present. 2. MSVC _MSVC_LANG C++17 noexcept/[[nodiscard]] parity (src/edg_be_common.h, src/edg_be_sdk.h, src/gcc_gen_be_error.h, tests/driver/test_edg_be_driver.cpp): - MSVC cl.exe defines __cplusplus as 199711L by default even under /std:c++17 unless /Zc:__cplusplus is supplied, reporting the active standard in _MSVC_LANG (201703L). Checking only __cplusplus caused EDG_BE_NOEXCEPT and GCC_GEN_BE_NOEXCEPT to expand empty on header declarations while .cpp definitions and edg_be_path_exists_fn_t carried noexcept, triggering C++17 P0012R1 function-type mismatches (MSVC C2382 and C2440). - Inspect _MSVC_LANG alongside __cplusplus in EDG_BE_NODISCARD, EDG_BE_NOEXCEPT, GCC_GEN_BE_NODISCARD, GCC_GEN_BE_NOEXCEPT, and enum gcc_gen_be_error, align edg_be_path_exists_fn_t on EDG_BE_NOEXCEPT, and add static_assert(noexcept(...)) plus callback function-pointer verification in test_edg_be_driver.cpp. 3. Release-posture VLA lowering layout (src/gcc_gen_be_expr.c, src/gcc_gen_be_stmt.c): - Debug macro configurations set LOWER_VARIABLE_LENGTH_ARRAYS=0 (exposing a_vla_dimension::dimension_variable), whereas Release macro configurations leave LOWER_VARIABLE_LENGTH_ARRAYS=1 (exposing a_vla_dimension::total_number_of_elements in src/il_def.h). Guard all four VLA dimension variable lookups on #if LOWER_VARIABLE_LENGTH_ARRAYS. 4. Windows MSVC CRT and dynamic libgccjit symbol resolution (src/gcc_gen_be_main.c, src/gcc_gen_be_omp.c, src/gcc_gen_be_lib_loader.h, src/gcc_gen_be_lib_loader.c): - Use _access(output_path, 0) from <io.h> on _WIN32 instead of POSIX access(output_path, F_OK) in gcc_gen_be_emit_artifact. - Include gcc_gen_be_lib_loader.h in gcc_gen_be_omp.c and bind p_gcc_jit_context_set_bool_allow_unreachable_blocks and p_gcc_jit_type_is_integral via GetProcAddress on _WIN32 so MSVC builds link without unresolved libgccjit imports. Signed-off-by: Samuel Marks <807580+SamuelMarks@users.noreply.github.com>
|
AcknowlEDG review results updated for
CI failure. |
…p#582] Resolve the three distinct root causes (plus a latent Linux ext4 directory-hash branch-coverage nondeterminism) behind the five failing CI checks on PR edgcpp#582: 1. Windows MSVC Stage-0 driver SoftFloat wiring (tests/driver/CMakeLists.txt): - test_edg_be_driver compiles test_edg_be_driver.cpp, src/edg_be_sdk.cpp, and src/edg_be_driver.cpp with -DUSE_CMAKE_DEFINES and ${CMAKE_BINARY_DIR}/src/includes. Under the windows-msvc-release preset, cmake_defines.h defines USE_SOFTFLOAT=1, causing src/targ_def.h:2377 to include "softfloat.h" (MSVC C1083). - Linux CI images masked the missing dependency because SoftFloat headers reside under /usr/local/include, whereas Windows CI builds SoftFloat out-of-tree and supplies EDG_SOFTFLOAT_INCLUDE_PATH and EDG_SOFTFLOAT_LIB_PATH. Include cmake/softfloat.cmake and wire add_softfloat_to_target(test_edg_be_driver) to match cpfe, cpfe-cp, and cdisp. 2. x86_64 libLLVM-18 Constant::getNullValue(VoidTy) UB segfault (src/llvm_gen_be_expr.h, src/llvm_gen_be_expr.cpp, tests/test_llvm_builtins.cpp): - Synthetic IL expression nodes with expr->type == nullptr (such as op2 in test_llvm_builtins.cpp's __builtin_expect fixture) lower via llvm_type_from_edg_type(nullptr, ...) to llvm::Type::getVoidTy(). Passing VoidTy (or raw FunctionType on enk_routine) into llvm::Constant::getNullValue hits the default llvm_unreachable arm in llvm/lib/IR/Constants.cpp, which compiles under -DNDEBUG in Ubuntu 24.04's x86_64 libLLVM.so.18.1 to __builtin_unreachable() with no epilogue, causing SIGSEGV (exit 139). - Introduce noexcept helper llvm_materialize_null_constant returning llvm_gen_be_error_t to substitute a first-class fallback LLVM type when expr_llvm_ty is void or FunctionType, percolate its status in enk_constant and enk_routine, harden test_llvm_builtins.cpp's evaluate_constant stub, and add 100% branch-coverage unit tests. 3. Linux ext4 HTree GCC CRT version discovery determinism (src/llvm_gen_be_driver.cpp, tests/test_llvm_orchestrator.cpp): - In discover_linux_gcc_crt_and_ldso, testing (gcc_crt_dir.empty() || ver_leaf > best_ver) within a single candidate base left the right-hand branch unexercised on Linux ext4 whenever HTree half-MD4 filename hashing yielded version "30" ahead of "20", "10", and "05". - Remove the redundant gcc_crt_dir.empty() guard (best_ver starts as "") and early base-directory break so all candidate_gcc_bases are scanned for the highest GCC version, and populate both candidate_gcc_bases[0] ("30") and candidate_gcc_bases[1] ("10") in test_llvm_orchestrator.cpp for deterministic True/False branch execution across all filesystems. 4. _BitInt(I) template non-type deduction expectation update (tests/tests/imported/clang/cpp/SemaCXX/.ext-int.rto/default.1.1.txt): - Reaching tptk_bit_precise_int in ttt_is_or_contains_deduced_template_param (src/types.c) and matching bit-width bounds in src/templates.c allows template<int I> void deduced_bound(_BitInt(I)) to deduce I=3 on deduced_bound(b) as upstream Clang expects (29 errors instead of 30). Update the recorded expectation accordingly. Signed-off-by: Samuel Marks <807580+SamuelMarks@users.noreply.github.com>
|
AcknowlEDG review results updated for
CI failure. |
…pp#582] Resolve the System V AMD64 long double / _Complex long double lowering and ABI classification defects behind the Ubuntu 24.04 x86_64 failure in test_llvm_e2e_execution (plus a latent x86_64 __int128 va_arg stack alignment trap and Clang 20+ <arm_neon.h> __mfp8 compatibility): 1. x86 / x86_64 fk_long_double and tk_complex element lowering (src/llvm_gen_be_type.cpp, tests/test_llvm_type_lowering.cpp): - llvm_type_from_float previously matched x86_fp80 only when edg_type->size * targ_char_bit == 80. Because edg_type->size records ABI storage sizeof(long double) rather than 80-bit x87 precision width, 16-byte-padded System V / MinGW x86_64 long double (128 bits in memory) mislowered to IEEE 754 binary128 (fp128, emitting __netf2 softfloat calls and binary128 bit patterns), while 12-byte System V i386 long double (96 bits) fell through to double. - Halve edg_type->size when edg_type->kind == tk_complex to obtain the per-component byte width, and select x86_fp80 for 80-bit (10B), 96-bit (12B i386), and 128-bit (16B non-Android x86/x86_64) representations while preserving ppc_fp128 on PowerPC, fp128 on 128-bit IEEE targets (AArch64, RISC-V, SystemZ, Android x86_64), and double otherwise. 2. System V AMD64 COMPLEX_X87 classification under DO_IL_LOWERING=1 (src/llvm_gen_be_abi_sysv_x86_64.h, src/llvm_gen_be_abi_sysv_x86_64.cpp, tests/test_llvm_abi.cpp, tests/test_llvm_e2e_execution.cpp): - With DO_IL_LOWERING=1 (LOWER_COMPLEX=1), lower_c99.c rewrites C99 _Complex long double into a tk_typeref referencing internal tk_struct "_Complex_long_double" (size 32). Checking only unlowered tk_complex caused 32-byte lowered _Complex long double to hit size > 16 -> MEMORY (sret in %rdi with void return), conflicting with Clang's System V psABI section 3.2.3 COMPLEX_X87 convention (no sret; align-16 stack byval arguments; { x86_fp80, x86_fp80 } returned in %st(0) and %st(1)). - Add noexcept helper is_sysv_complex_x87_type returning llvm_gen_be_error_t to recognize both unlowered tk_complex and synthesized _Complex_long_double / _Complex_float80 structs while keeping user-defined 32-byte aggregates and Android fp128 _Complex long double in MEMORY / sret, and propagate >8-byte parameter alignments onto System V byval attributes. - Extend test_e2e_complex_clang_abi to exercise bidirectional Clang <-> cpfe _Complex long double calls. 3. System V x86_64 multi-eightbyte va_arg alignment & NEON Clang 20+ (src/llvm_gen_be_abi_sysv_x86_64.cpp, tests/test_llvm_e2e_execution.cpp): - Align temporary register-reassembly buffer vaarg.reg.tmp ([2 x i64]) to 16 bytes in lower_sysv_va_arg so 16-byte-aligned i128 loads (__int128 va_arg) never fault on x86_64 aligned SSE instructions. - Pass --clang_version=210000 in the macOS ARM64 <arm_neon.h> smoke test so Clang 20+ ARMv9.5 FP8 (__mfp8 and mf8_fpm) builtins are enabled when modern host resource headers are included. Signed-off-by: Samuel Marks <807580+SamuelMarks@users.noreply.github.com>
|
AcknowlEDG review results updated for
|
|
AcknowlEDG review results updated for
CI failure. |
Add unified Stage-0 multi-backend driver, native LLVM IR & GCC (
libgccjit) backends, DWARF EH runtime, and 5-way differential test suite. This PR follows the encouraging; intense interest shown in #221 #239 (and #245).Summary
This pull request transforms
cpfefrom a source-to-source C/C++ front end into a single-binary, runtime-selectable multi-backend native C/C++23 compiler while preserving 100% backward compatibility with the existing C-generating (c_gen_be) and C++-generating (cp_gen_be/cpfe-cp) pipelines.Across 111 new C/C++ compiler and runtime files (~81.9k LOC), minimal
#if-guarded front-end hooks, cross-platform CMake/preset integration, static error-handling & documentation coverage gates, and 414 new test files (~91.4k LOC),cpfecan now lower EDG Intermediate Language (IL) directly in-memory to native object files, assembly, bitcode, shared libraries, and linked executables via four runtime-selectable code generation pipelines:src/llvm_gen_be*— 63 files, 40,047 LOC): Direct EDG IL → in-memoryllvm::ModuleSSA lowering targeting LLVM 18–23+NewPMoptimization pipelines, 12 target calling-convention ABIs, zero-cost Itanium DWARF / Windows SEH / SjLj / Wasm EH, C++20llvm.coro.*switched-resume coroutines, OpenMP 4.5/5.x CPU (libomp) & GPU (nvptx64/amdgcn) offloading, sanitizers, ThinLTO/FullLTO, PGO, and DWARF v5 / CodeView PDB debug info.libgccjit) Backend (src/gcc_gen_be_*— 40 files, 37,414 LOC) + Thread-Safe EH Runtime (lib_src/gcc_be_eh_rt.*— 2 files, 1,028 LOC): Direct EDG IL →gcc_jit_contextGIMPLE/RTL lowering with zero compile-time or link-time hard dependency onlibgccjit.sovia version-probed runtimedlopen/LoadLibraryAsymbol resolution across GCC 10–15+, paired withlibedg_gcc_eh_rt.afor thread-safe DWARF personality-backed unwinding and Itanium_ZTIcatch matching.src/edg_be_*— 5 files, 3,186 LOC): Drop-in GCC/Clang-compatible CLI translation (-c,-S,-E,-o,-O0..-Ofast,-g,-std=*,-fPIC,-shared,-MD/-MMD/-MF/-MT/-MQ,-Wl,*,@fileresponse files, multi-TU compilation & linking, and--backend={llvm,gcc,c}) plus automatic macOS SDK, Linux multiarch (libstdc++/libc++/Clang resource), and Windows MSVC/UCRT include discovery.c_gen_be) & Isolated C++ Backend (cp_gen_be):c_gen_be(EDG_ENABLE_C_BACKEND=ON) now coexists in the samecpfebinary alongside the LLVM and GCC backends viac_gen_be_entry()(--backend=c/--c-be), whilecpfe-cp(BACK_END_IS_CP_GEN_BE) remains completely isolated on its existing code path.Motivation
Historically,
cpfedelegated machine code generation to downstream host compilers by emitting lowered C (c_gen_be) or reconstructed C++ (cp_gen_be). While portable, source-to-source C emission imposes structural semantic and performance limitations:setjmp/longjmpruntime tables (DO_FULL_PORTABLE_EH_LOWERING), incurring per-scope registration overhead on the non-throwing path and preventing native DWARF.eh_frame/ Windows x64 SEH interoperability with system C++ libraries.CoroSplit), C11/C++20 lock-free atomic memory orderings, architecture-specific vector intrinsics (SSE/AVX/NEON), and OpenMP parallel/SIMD/target regions cannot be faithfully represented in portable ISO C.LLVMCore/LLVMPasses) and GCC (libgccjitGIMPLE/RTL) directly atop the same lowered EDG IL lets users target either major open-source optimizer from one front end and enables 5-way cross-compiler differential verification on identical AST/IL inputs.Detailed Changes by Subsystem
1. Unified Stage-0 Driver, SDK Discovery & Multi-TU Routing
src/edg_be_common.h,src/edg_be_driver.{h,cpp},src/edg_be_sdk.{h,cpp},src/cfe.c,src/cmd_line.{h,c},util/eccp.shedg_be_translate_command_line):edg_be_invocation_options_tcontract shared acrosscfe.c,llvm_gen_be,gcc_gen_be, andc_gen_be, while preserving native EDG flags untouched when invoked in traditionalcpfemode.@fileresponse files (edg_be_expand_response_files), emits Makefile dependency files (-MD,-MMD,-MF,-MT,-MQviaedg_be_write_depfile), and answers compiler queries (--version,-dumpmachine,-dumpversion,--print-search-dirs,--print-target-triple,--print-effective-options).edg_be_discover_system_sdk):--sysroot,SDKROOT, macOS Xcode/CommandLineTools SDKs + Homebrew LLVM/GCC installations, Linux multiarch triples (x86_64-linux-gnu,aarch64-linux-gnu, etc.) forlibstdc++,libc++, and Clang resource headers, and Windows MSVC/UCRT layouts.cpfe a.cpp b.cpp -o app), object-only link invocations (cpfe a.o b.o -o app), and mixed source/object builds via per-TU isolated subprocess compilation (spawn_driver_subcommand) and backend link finalizers (llvm_finalize_multi_tu_link,gcc_gen_be_link_multi_tu_artifacts).eccp.shWrapper Integration:--llvm/EDG_USE_LLVM_BACKEND=1and--gcc-be/--gcc_be/--gcc_gen_be/EDG_GCC_BACKEND=1pass-through modes.2. Native LLVM IR Backend (
src/llvm_gen_be*)40,047LOC) undersrc/llvm_gen_be*.{h,cpp}llvm_gen_be_type.*,llvm_gen_be_const.*,llvm_gen_be_expr.*,llvm_gen_be_stmt.*,llvm_gen_be_decl.*):_BitInt(N)(llvm::IntegerType::get(Ctx, N)),_Float16/__bf16/_Float128(fp128) / x87x86_fp80, IEEE-754-2008 decimal floating-point (_Decimal32/_Decimal64/_Decimal128BID & DPD encodings +__bid_*/__dpd_*runtime lowering), C99_Complex, vector types, bit-fields, VLAs (stacksave/stackrestore), computedgoto(indirectbr), statement expressions, and C++17 prvalue in-place destination materialization.llvm_gen_be_abi_*.{h,cpp}):sret/byval/inreg/swiftselfattributes, and variadicva_arglowering for:sysv_x86_64), Windows x64 (win64), ARM64 AAPCS64 & Darwinpcs (aapcs64), x86-32 cdecl/stdcall/fastcall/thiscall (x86_32), ARM32 AAPCS/AAPCS-VFP (arm32), RISC-V RV64GC LP64D (riscv64), PowerPC64 ELFv2 (ppc64), IBM SystemZ (s390x), MIPS64 N64 (mips), LoongArch64 LP64D (loongarch64), SPARC64 v9 (sparc), and WebAssembly (wasm32/wasm64).llvm_gen_be_vtable.*,llvm_gen_be_rtti.*,llvm_gen_be_ptrmem.*,llvm_gen_be_eh.*):this/covariant return thunks,_ZTI*/_ZTS*RTTI descriptors (si_class,vmi_class), pointer-to-member representations, and chained DWARF (__gxx_personality_v0), SjLj (__gxx_personality_sj0), Windows SEH (__CxxFrameHandler3cleanuppad/catchswitch/catchpad), and Wasm EH lowering.llvm_gen_be_coro.*,llvm_gen_be_omp.*,llvm_gen_be_intrinsics.*,llvm_gen_be_asm.*):llvm.coro.id/begin/save/suspend/end/freelowering for LLVMCoroSplitpasses.parallel,for,sections,single,task,critical,master/masked,barrier,atomic,simd, andtargetGPU offloading (nvptx64-nvidia-cuda,amdgcn-amd-amdhsa) targetinglibomp/libomptarget.llvm_gen_be_opt.*,llvm_gen_be_codegen.*,llvm_gen_be_debug*.{h,cpp}):PassBuilder(-O0..-O3,-Os,-Oz), ASan/TSan/MSan/UBSan/HWASan, SafeStack/ShadowCallStack, stack protectors, ThinLTO/FullLTO bitcode summaries, PGO generation/use, and fullDIBuilderDWARF v5 (including Split DWARF) & Windows CodeView debug info.3. Native GCC (
libgccjit) Backend & Thread-Safe EH Runtime37,414LOC) undersrc/gcc_gen_be_*.{h,c}+ 2 runtime files (1,028LOC) underlib_src/gcc_be_eh_rt.{h,c}gcc_gen_be_lib_loader.*):libgccjit.so/libgccjit.dylib/libgccjit-0.dllat runtime (dlopen/LoadLibraryA), resolving mandatory GCC 10 baseline entry points and optional GCC 11–15+ capabilities (_BitInt, vector rvalues, target-specific builtins, TLS models, global initializers, inline asm) with graceful capability fallbacks.gcc_gen_be_type.*,gcc_gen_be_decl.*,gcc_gen_be_expr.*,gcc_gen_be_stmt.*,gcc_gen_be_cache.*): Struct/union bit-field & tail-padding layout matching EDG byte offsets, compound literals, statement expressions, computedgoto(gcc_jit_block_end_with_extended_asm_goto/ dispatch fallback), VLAs, and static constructors/destructors.gcc_gen_be_abi.*,gcc_gen_be_rtti.*,gcc_gen_be_dtor.*): Vtables, VTTs, thunks,_ZTIdescriptors,dynamic_cast/typeid, and reverse-order automatic/temporary destructor emission.gcc_gen_be_atomic.*,gcc_gen_be_coro.*,gcc_gen_be_omp.*,gcc_gen_be_simd.*,gcc_gen_be_builtin.*):__atomic_*builtin &libatomicfallback lowering, C++20 coroutine heap frame layout calculation, OpenMP#pragma ompregion outlining to GNUlibgomp(GOMP_parallel, worksharing, barriers, criticals), and x86 SSE/AVX + ARM64 NEON vector construction/shuffle/lane intrinsics.gcc_gen_be_eh.*,lib_src/gcc_be_eh_rt.{h,c}→libedg_gcc_eh_rt.a):thread_localunwind state (__edg_gcc_eh_get_tls_chain).__edg_gcc_eh_invoke_region, a real DWARF personality-backed unwind trampoline compiled with-funwind-tables -fasynchronous-unwind-tables, paired with_Unwind_RaiseExceptionrethrow/resume bridging and vptr-inspected Itanium_ZTIsingle/multiple/virtual inheritance hierarchy catch matching.4. Minimal, Guarded Front-End IL & Lowering Extensions (
src/*)All modifications to existing front-end sources are strictly
#if-guarded (BACK_END_IS_LLVM_GEN_BE,BACK_END_IS_GCC_GEN_BE,DO_IL_LOWERING) so non-native configurations retain identical behavior:src/fe_wrapup.c,src/il_def.h,src/lower_il.c): Snapshots pre-lowering routine signatures (unlowered_typeontk_routine) beforelower_file_scope()mutates return/parameter types (e.g.,thisinjection, NRVO/sret rewriting) so native backends emit exact Itanium/MSVC mangled symbol names.src/fe_wrapup.c,src/il_alloc.*): KeepsFRONT_END_REGION_NUMBERalive until native backend code generation completes whenBACK_END_IS_LLVM_GEN_BE || BACK_END_IS_GCC_GEN_BEis active.src/cfe.c): Setstarg_ia64_abi_use_int_static_init_guard = FALSEon 64-bit native targets when generating native code so__cxa_guard_acquirereceives ABI-compliant 64-bit guard variables._BitInt(N)template deduction & C++17 host build cleanups (src/templates.c,src/types.c,src/folding.c,src/const_ints.*,src/float_pt.c,src/ifc_modules_read.c,src/lexical.c,src/host_envir.*,src/linux_libc_compat.c): Supports template argument deduction for dependent_BitInt(N)bit-width expressions, avoids macro collisions with LLVM/Windows SDK headers (WIN32_LEAN_AND_MEANgranular Win32 headers,linux_libc_compat.cfor glibc C23__isoc23_strtol), and upgradessrc/CMakeLists.txtto C++17 (required by LLVM C++ headers) with-fno-exceptions -fno-rttiparity on GCC, Clang, and MSVC (/EHs-c- /GR-).5. Build System, Presets, Packaging & CI Workflows
CMakeLists.txt,cmake/macro-conf.cmake,cmake/FindLibGCCJIT.cmake):EDG_ENABLE_LLVM_BACKEND(OFFby default;ENABLE_LLVM_BACKENDsupported as alias)EDG_ENABLE_GCC_BACKEND(OFFby default)EDG_ENABLE_C_BACKEND(ONby default)EDG_LLVM_BE_COVERAGE/EDG_GCC_BE_ENABLE_COVERAGE(OFFby default)DO_FULL_PORTABLE_EH_LOWERING=0andGENERATE_EH_TABLES=0when either native backend is enabled, while keeping portable EH tables enabled for standalone C-backend builds.CMakePresets.jsonPresets &cmake/macro-conf/Targets:llvm-backend-debug,llvm-backend-release,llvm-backend-coveragelinux-gcc-be-debug,linux-gcc-be-release,macos-arm-gcc-be-debug,macos-arm-gcc-be-releasemultibackend-debug,multibackend-releaselinux-arm-{gcc,clang}{,-release}andmacos-x86-clang*macro configurations plus Windows MSVC SoftFloat support (cmake/softfloat.cmake)..github/workflows/):strict-build-check.yml: Addsbackend-modes-checkverifying all 4 combinations ofEDG_ENABLE_LLVM_BACKEND×EDG_ENABLE_GCC_BACKEND(neither,llvm,gcc,llvm+gcc) viadev_tools/verify_backend_modes.py.llvm_be_coverage.yml&build-and-test-ci.yml: Enforces Doxygen documentation coverage and Clang source-based code coverage gates.release.yml: 15-job multi-OS (linux-x86_64,linux-aarch64,macos-aarch64,windows-x86_64,windows-arm64) × 3-flavor (edgcpp+llvm,edgcpp+gcc,edgcpp+llvm+gcc) release packaging workflow with CPack archives.6. Verification, Static Policy Enforcement & 5-Way Differential Suite
noexceptPolicy (dev_tools/check_error_and_noexcept_policy.py+ unit tests):throw/try/catchconstructs across all C++ driver and backend TUs, mandatory[[nodiscard]]/warn_unused_resulterror enums (edg_be_driver_error_t,llvm_gen_be_error_t,gcc_gen_be_error_t), andnoexceptannotations on every function definition.dev_tools/check_doc_coverage.py(LLVM backend),dev_tools/check_gcc_be_doc_coverage.py(GCC backend), anddev_tools/check_driver_doc_coverage.py(Stage-0 driver & SDK).tests/driver/*): CLI flag translation,@fileresponse expansion, depfiles, SDK discovery, and multi-TU orchestration.tests/test_llvm_*,tests/lit/**,tests/llvm_ir_backend_tests/*,tests/realworld/*,tests/fuzz_llvm_backend.cpp): GoogleTest unit/integration tests, LLVMlit+FileCheckIR verification, end-to-end execution harnesses, LibFuzzer harness, and real-world single-header C/C++ libraries.tests/gcc_be/*): 70 files covering types, expressions, statements, Itanium vtables/RTTI, thread-safe DWARF EH unwinding,_Atomic, coroutines, OpenMP, SIMD, sanitizers, and cross-TU ABI compatibility.tests/differential/**): 232 single-TU and multi-TU test cases across 12 categories (cat01_int_bit,cat02_fp_complex,cat03_abi_agg,cat04_control_flow,cat05_obj_model,cat06_eh_cleanup,cat07_rtti_dyncast,cat08_templates_lambdas,cat09_coroutines,cat10_atomics_tls,cat11_gnu_ext,cat12_cross_abi). Every case is compiled and executed 5 ways:cpfe --backend=llvm -O0cpfe --backend=llvm -O2cpfe --backend=gcc -O0cpfe --backend=gcc -O2clang++/g++)-O2asserting identical exit codes,
stdout, andstderr(including mixed-TU binaries where TU A is compiled by--backend=llvmand TU B is compiled by--backend=gcc).7. Documentation
INTERNALS_OF_LLVM_AND_GCC_BACKENDS.mddocumenting the multi-backend architecture, IL lowering contracts, target ABI state machines, EH runtime design, and build/test workflows.Doxyfile.llvm_beand updatesdoc/source/ext_intf.rst.Build & Verification Quickstart
Backward Compatibility & Risk Isolation
EDG_ENABLE_LLVM_BACKENDandEDG_ENABLE_GCC_BACKENDdefault toOFF. Existing presets (linux-gcc-debug,linux-clang-debug,macos-arm-clang-debug,windows-msvc, etc.) continue buildingcpfeandcpfe-cpwithout requiring LLVM orlibgccjitinstalled.cpfe-cpuntouched: All Stage-0 driver hooks and native backend entry points insrc/cfe.candsrc/fe_wrapup.care guarded by#if !BACK_END_IS_CP_GEN_BE/#if BACK_END_IS_LLVM_GEN_BE || BACK_END_IS_GCC_GEN_BE.libgccjitloading: Even when compiled with-DEDG_ENABLE_GCC_BACKEND=ON,cpfedynamically loadslibgccjitviadlopen/LoadLibraryAonly when--backend=gccis invoked, so binaries run cleanly on machines withoutlibgccjitwhen using--backend=llvmor--backend=c.